<?php

/**
 * BH MEDIA
 * @author Ha Anh Man - manphp@binhhoang.com
 * @version 1.0
 * @package JobSearch
 * @copyright 2012
 * 
 */
class CategoryModel {

    public function __construct() {
        
    }

    public function getCategoryParent($cate_id = 0) {
        $condition = new CDbCriteria();
        $condition->condition = 'parent_id = ' . $cate_id;
        $condition->select = 'id, name, alias, banner, icon, weight, status';
        $condition->order = 'weight';
        return Category::model()->findAll($condition);
    }

    public function getCategory($cate_id = 0) {
        return Category::model()->findByPk($cate_id);
    }

    public function updateWeight($id, $weight) {
        Category::model()->updateAll(array('weight' => $weight), 'id = ' . $id);
    }

}